﻿using System;
using AiFrame.InterfaceLib.Data.Patterns;

namespace AiFrame.InterfaceLib.MVP
{
    /// <summary>
    /// Delegate for the menu item click event.
    /// </summary>
    /// <param name="sender">The calling class.</param>
    /// <param name="e">Event arguments.</param>
    public delegate void OnMenuItemClickProcedure(object sender, EventArgs e);

    /// <summary>
    /// Represents the main menu which allows other
    /// assemblies to register in.
    /// </summary>
    public interface IMainMenu
    {
        /// <summary>
        /// Adds a menu item to the main menu and returns it.
        /// </summary>
        /// <param name="caption">The element's caption.</param>
        /// <param name="name">Unique name of the item.</param>
        /// <param name="tooltip">Tooltip text.</param>
        /// <param name="parentName">The unique name of the parent control.</param>
        /// <param name="clickProcedure">The procedure for the on click event. Optional, can be NULL.</param>
        /// <returns>The menu item</returns>
        object AddMainMenuItem(string caption, string name, string tooltip, string parentName, OnMenuItemClickProcedure clickProcedure);

        /// <summary>
        /// Adds a menu item to the main menu and returns it.
        /// </summary>
        /// <param name="caption">The element's caption.</param>
        /// <param name="name">Unique name of the item.</param>
        /// <param name="tooltip">Tooltip text.</param>
        /// <param name="parent">The parent control.</param>
        /// <param name="clickProcedure">The procedure for the on click event. Optional, can be NULL.</param>
        /// <returns>The menu item</returns>
        object AddMainMenuItem(string caption, string name, string tooltip, object parent,
                               OnMenuItemClickProcedure clickProcedure);
        
        /// <summary>
        /// Adds a menu item to the main menu and returns it.
        /// </summary>
        /// <param name="caption">The element's caption.</param>
        /// <param name="name">Unique name of the item.</param>
        /// <param name="tooltip">Tooltip text.</param>
        /// <param name="parent">The parent control.</param>
        /// <param name="clickProcedure">The procedure for the on click event. Optional, can be NULL.</param>
        /// <param name="shortCutKeys">The shortcut keys.</param>
        /// <returns>The menu item</returns>
        object AddMainMenuItem(string caption, string name, string tooltip, object parent, OnMenuItemClickProcedure clickProcedure, object shortCutKeys);

        /// <summary>
        /// Removes a menu item from the main menu.
        /// </summary>
        /// <param name="menuItem">The object to remove.
        /// It is the same object which is returned by the AddMainMenuItem method.</param>
        void RemoveMainMenuItem(object menuItem);
    }

    /// <summary>
    /// Defines standard names for menu items.
    /// </summary>
    public enum MainMenuItems
    {
        /// <summary>
        /// The file menu.
        /// </summary>
        [StringValue("fileToolStripMenuItem")]
        FileMenu = 0,

        /// <summary>
        /// The export menu item.
        /// </summary>
        [StringValue("exportMenuItem")]
        ExportMenuItem = 10,

        /// <summary>
        /// The import menu item.
        /// </summary>
        [StringValue("importMenuItem")]
        ImportMenuItem = 20
    }
}
